
#ifndef __CGAMEAPP_H
#define __CGAMEAPP_H

//=== Include =============================================
#import <OpenGLES/ES1/gl.h>
#include "stdTypes.h"
#include "StdDefs.h"
#include "randGen.h"
//#include "SoundEngine.h"
#include "image.h"
#include "XString.h"
#include "CGraphicFont.h"
#include "graphics.h"
#include "rect.h"
#include "touchInput.h"
#include "LinkList.h"
#include "XCommon.h"
#include "BasePage.h"
//#include "GameScene.h"

class CGameScene
{
    
};
#define NO_SOUND 1

#define MAX_SOUNDID 100

class CGameApp
{
public:
	CGameApp();
	~CGameApp();
	
	static void OnInit(void * pView);
	static void OnFree();
	
	static void HandleUpdate(int timeElapsedMS);
	static void HandleRender();

	static void   InitSound();
	static void	  SetVolume(float volume_bg,float volume_se);
	static void   PlaySound( int id );
	static void   LoadSound( const char *path, int id);
	static void   PlayMusic( const char *path, boolean loop=TRUE );
	static bool   IsPlayingMusic();

	static inline int ScreenWidth(){return 320;}
	static inline int ScreenHeight(){return 480;}
	
	static void InitPerspective(GLfloat fovy, GLfloat aspect, GLfloat zNear, GLfloat zFar);
	static void Enable3D();
	static void Enable2D();
	
	static void SetControllData(CGameControll * conData);
	static CGameControll * GetControllData();
	static void ControllCallBack();
	static void DeleteControll();

	static void	SetGameInterrupt(boolean interrupt);
		
	static CGameScene *         GetGameScene(){return m_pGameScreen;}
 	static CRandGen*            GetRandGenPtr(){return m_pRandGen;}
	static CTouchInput*			GetTouchInput( void ){ return m_pTouchInput; }
	static void *				GetView(){return m_pView;}

	static void  GameAppInterruptionListener( void *inUserData, int32 interruptionState );
private:
	static CGameApp *               m_pGameApp;
	static CTouchInput*				m_pTouchInput;
	static CRandGen*				m_pRandGen;
	static CGameScene *             m_pGameScreen;
	static CGameControll *          m_pControllData; 
	static void *                   m_pView;
};

#endif // __CGAMEAPP_H
